﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Xml.Linq;
using Repository.EF;
using Repository.Repositories.Interfaces;

namespace Repository.Repositories.XMLRepository
{
    public class SkillPointsRepository: ISkillPointsRepository
    {
        public List<SkillPoints> QueryAll()
        {
            var root =
                XElement.Load(ConfigurationManager.AppSettings["XMLRepositoryDir"] + "SkillPointsRepository.xml")
                .Elements();

            if (root == null)
                return new List<SkillPoints>();

            var all = from sp in root.Elements()
                select new SkillPoints()
                {
                    Id = Convert.ToInt32(sp.Element("Id").Value)
                };
            return all.ToList();
        }

        public List<SkillPoints> QueryAllMain()
        {
            throw new NotImplementedException();
        }

        public SkillPoints FirstOrDefault(Func<SkillPoints, bool> exp)
        {
            throw new NotImplementedException();
        }

        public void Persist(SkillPoints skillPoints)
        {
            throw new NotImplementedException();
        }
    }
}
